<style type="text/css">
body{background:#eee}
.storelogo img{width:3.2rem;height:3.2rem}
.merchgroup .store-star {padding:0.1rem 0 0.2rem 0;font-size:0.55rem;line-height:1rem}
.merchgroup .store-star img{height:0.66rem}
.star-on,.star-off{position:absolute;top:1rem;left:0;overflow:hidden}
.star-rate {margin-left:0.2rem;color:#19b955}
.store-distance{float:right;color:#999}
.store-moneylimit{font-size:0.55rem}
</style>
<div class="fui-page-group" ng-if="pagedata.op == 'main'">
<div class="fui-page fui-page-current page-goods-list">
	<div class="fui-header">
		<div class="fui-header-left">
			<a class="back"></a>
		</div>
		<div class="title">
			<div ng-class="{'searchbar center':1,'searchbar-active':pagedata.searchbar ==1}">
					<input type="button" ng-click="access(pagedata.op,made_query(pagedata.params))"  value="搜索" class="searchbar-cancel searchbtn">
					<div class="search-input" ng-click="pagedata.searchbar =1">
						<input type="search" placeholder="输入关键字" class="search" ng-model="pagedata.params.keyword">
					</div>
			</div>
		</div>
		<div class="fui-header-right" data-nomenu="true">
			<a href="javascript:;"><i class="icon jinyunicon icon-fenlei2" id="listblock" data-state="list"></i></a>
		</div>
    </div>
	<div class="sort">
		<div class="item on" ng-click="getlist()"><span class="text">综合</span></div>
		<div class="item" data-order="sales" href="javascript:" ng-click="getlist('juli')"><span class="text">距离</span></div>
		
		<div class="fui-list-group merchgroup" ng-repeat="item in pagedata.list">
            <div class="fui-list">
                <a class="fui-list-media storelogo" href="javascript:;" ng-click="access_json('jy_cmso2o/index/detail/id='+item.id)">
                    <img class="round" ng-src="{{tomedia(item.logo) || '../core/resource/images/nopic.jpg'}}">
                </a>
                <a class="fui-list-inner" style="margin-top:0.16rem" href="javascript:;" ng-click="access_json('jy_cmso2o/index/detail/id='+item.id)">
                    <div class="title" style="font-size:0.76rem"><span>{{item.title}}</span></div>
                    <div class="store-star">
						<span class="star-rate">4.5分 挺好哒-性价比高</span>
						<span>688条评价</span>
					</div>
					<div class="subtitle" style="font-size:0.55rem">
						<div class="store-moneylimit">
						  <span>距您{{item.juli}}公里</span>
						  <span class="store-distance"> 电话：{{item.phone}}</span>
						</div>
					</div>
                </a>
            </div>
			
		</div>
		<div ng-show="loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
		
    </div>
</div>
<script type="text/javascript">
scope.loading = true;
var lat_lng ={}
	scope.scroll(function(){
		scope.$apply();
		setTimeout('getlist()',2000);
	},false,'svposttext');
// 百度地图API功能
window.scope.location(function(re){
		//console.log(re);
		lat_lng = re.lat_lng;
		getlist(re.lat_lng);
});
var page = 1;
function getlist(){
//console.log('lat_lng');console.log(lat_lng);
		var params = {
					'plugin':'jy_cmso2o',
					'action':'index',
					'op':'list',
					'data':{
						'page':page,
						'lat_lng':lat_lng,
					},
					'callback':function(data){
						if(data.error !=1){
							 for (var i=0;i<data.list.length;i++){
									scope.pagedata.list.push(data.list[i]);
								}
								if(page >1){
									$("#merchgroup").animate({scrollTop:0},300);
								}
								page++;
								scope.loading = false;
								window.scope.pagedata.list=data.list;
								scope.$apply();
							}else{
								onsole.log('error');
							};	
					}
		}
		scope.post_json(params);
}

   
</script>
</div>
<div class="fui-page" ng-if="pagedata.op == 'detail'">
<div class="fui-content" style="margin-bottom:2.5rem">
	<div class="fe-mod-9" style="height:11rem;min-height:6rem">
		<div id="l-map" style="height: 11rem;padding:0px 0px;"></div>
		<div class="group-top" style="background:rgba(0,0,0,0.3);position: absolute;top:7rem;width:100%">
			 <div class="fui-list jump text-center">
				  <a class="fui-list-inner" href="">
					 <div class="title" style="color: #fff;margin:0.8rem 0 0.3rem 0">{{pagedata.detail.title}}</div>
					 <div class="subtitle" style="color: #fff;font-size:0.55rem">类型:{{pagedata.detail.groupname || '未定义'}} | 联系电话：{{pagedata.detail.phone || '未定义'}}</div>
					 <div class="subtitle" style="color: #f60;font-size:0.4rem">地址：{{pagedata.detail.address}}</div>
				   </a>
			  </div>
		</div>
		<div class="fe-mod-9-shoplogo" style="top:4rem"> 
			<div class="fe-mod-9-shoplogo-img" style="">
				<img src="{{tomedia(pagedata.detail.logo) || '../core/resource/images/nopic.jpg'}}">
			</div>
		</div>
	</div>
	<div class="weui_cells_title" style="background-color: #fff;border-bottom: 1px dashed #fafafa;margin-bottom:0;padding-top:10px"><i class="icon jinyunicon icon-dianpu" style="font-size:0.76rem"></i>商家服务</div>
	<div class="weui_cells weui_cells_access">
				<a class="weui_cell">
					<div class="weui_cell_hd"><i class="icon jinyunicon icon-shijian" style="font-size:0.9rem"></i></div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>营业时间：{{pagedata.detail.onlinetime.start || '8:00'}}点 ~ {{pagedata.detail.onlinetime.end || '18:00'}}点</span>
					</div>
				   
				</a>
				<a class="weui_cell">
					<div class="weui_cell_hd"><i class="icon jinyunicon icon-ditu" style="font-size:0.9rem"></i></div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>商家地址：{{pagedata.detail.address}}</span>
					</div>
				  
				</a>
				<a class="weui_cell">
					<div class="weui_cell_hd"><i class="icon jinyunicon icon-phone" style="font-size:0.9rem"></i></div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>电话：{{pagedata.detail.phone}}</span>
					</div>
				</a>
				<a class="weui_cell">
					<div class="weui_cell_hd"><i class="icon jinyunicon icon-fuwuchuanga" style="font-size:0.9rem"></i></div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>商户网址:{{pagedata.detail.url}}</span>
					</div>
				</a>
	</div>
	<div ng-if="pagedata.detail.desc" class="weui_cells_title">商户描述</div>
	<div ng-if="pagedata.detail.desc" class="weui_cells">
				<div class="weui_cell desc">
					{{pagedata.detail.desc}}
				 </div>
	</div>
	<div class="weui_btn_area">
		<a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="access_json('/merchants/ruzhu')">申请入驻</a>
	</div>
	</div>
	<script type="text/javascript">
	// 百度地图API功能
	require(['map'], function(BMap){
		var map = new BMap.Map("l-map");
		var lng=scope.pagedata.detail.lat_lng.lng ? scope.pagedata.detail.lat_lng.lng : '113.941134';
		var lat=scope.pagedata.detail.lat_lng.lat ? scope.pagedata.detail.lat_lng.lat : '22.546011';
		var point = new BMap.Point(lng, lat);
		map.centerAndZoom(point, 15);
		// 编写自定义函数,创建标注
		function addMarker(point){
		  var marker = new BMap.Marker(point);
		  map.addOverlay(marker);
		}
		addMarker(point);
	});
	</script>
</div>
<div ng-include="sys_html('_footer')"></div>